package com.hengpeng.itfints.controller.member;

import java.util.Calendar;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.util.StringHelper;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hengpeng.common.exception.ServiceResult;
import com.hengpeng.common.persist.entity.AbstractEntity.BoolValue;
import com.hengpeng.common.util.DES;
import com.hengpeng.common.util.DateTimeUtil;
import com.hengpeng.itfinbase.constants.RespCodeConstants;
import com.hengpeng.itfinbase.constants.TransCodeConstants;
import com.hengpeng.itfinbase.en.InvestStatus;
import com.hengpeng.itfinbase.en.TransType;
import com.hengpeng.itfinbase.message.ResponseMessage;
import com.hengpeng.itfinbase.message.partner.PartnerTransType;
import com.hengpeng.itfinbase.message.partner.QueryCardInfoRequestMsg;
import com.hengpeng.itfinbase.message.partner.QueryCardInfoResponseMsg;
import com.hengpeng.itfinbase.message.userInfo.UserInfoResponse;
import com.hengpeng.itfinbase.persist.Account;
import com.hengpeng.itfinbase.persist.AccountLog;
import com.hengpeng.itfinbase.persist.ReceivePlan;
import com.hengpeng.itfinbase.persist.UserInfo;
import com.hengpeng.itfinbase.persist.UserInfo.UserQuestionType;
import com.hengpeng.itfinbase.persist.VerifyCode.VerifyType;
import com.hengpeng.itfints.constants.PartnerUtil;
import com.hengpeng.itfints.controller.BaseController;
import com.hengpeng.itfints.tools.PageUtil;
import com.hengpeng.itfints.vo.MemberSession;

/**
 * <pre>
 * 会员中心控制类
 * </pre>
 * @author weiyuan
 * @version 1.0, 2015年7月6日
 */
@Controller
@RequestMapping("/memberCenter")
public class MemberCenterController extends BaseController
{
	protected Log logger = LogFactory.getLog(this.getClass());

	/**
	 * <pre>
	 * 账户总览
	 * </pre>
	 * @param map
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/index")
	public String index(ModelMap map, HttpServletRequest request)
	{
		UserInfo m = getSessionMember(request).getUser();
		Account account = serviceFactory.getAccountService().getAccount(m.getId());
		String nowInterestMoney = serviceFactory.getRepaymentService().getInterestMoney(m.getId(), new Date());
		List<String> nextInfos = serviceFactory.getRepaymentService().getNextReceiveDayInfo(m.getId());//待回款
		List<String> receivedInfos = serviceFactory.getRepaymentService().getReceivedInfo(m.getId(),ReceivePlan.ReceiveStatus.RECEIVED);//已回款
		List<String> receivingInfos = serviceFactory.getRepaymentService().getReceivedInfo(m.getId(), ReceivePlan.ReceiveStatus.RECEIVING);//回款中
		List<String> investingInfos = serviceFactory.getRepaymentService().getInvestingInfo(m.getId(), InvestStatus.INVESTING);//投标中
		List<ReceivePlan> receivePlan = serviceFactory.getRepaymentService().getIndexReceivePlans(m.getId(), 1,5);//回款计划
		map.put("nextInfos", nextInfos);
		map.put("receivedInfos", receivedInfos);
		map.put("receivingInfos", receivingInfos);
		map.put("investingInfos", investingInfos);
		map.put("account", account);
		map.put("nowInterestMoney", StringHelper.isEmpty(nowInterestMoney) ? "0" : nowInterestMoney);
		map.put("nowDate", DateTimeUtil.formatToStr(new Date(), DateTimeUtil.DATE_FORMAT_YMD));
		return "/page/account/index.jsp";
	}

	/**
	 * <pre>
	 * 我的资金明细
	 * </pre>
	 * @param map
	 * @param request
	 * @param type
	 * @param status
	 * @param queryTime
	 * @return
	 */
	@RequestMapping(value = "/myAccountLogList")
	public String myAccountLogList(ModelMap map, HttpServletRequest request, TransType type, String queryTime, String curPage)
	{
		int int_curPage = (!StringHelper.isEmpty(curPage) ? Integer.parseInt(curPage) : 1);

		UserInfo m = getSessionMember(request).getUser();
		Account account = serviceFactory.getAccountService().getAccount(m.getId());
		ServiceResult<List<AccountLog>> serviceResult = serviceFactory.getAccountService().queryAccountLogList(m.getId(), type,
				queryTime,int_curPage,10);
		PageUtil pUtil = new PageUtil(10, serviceResult.getReturnListSize(), int_curPage);
		map.put("myAccountLogList", serviceResult.getReturnValue());
		map.put("account", account);
		map.put("type", type);
		map.put("queryTime", StringHelper.isEmpty(queryTime) ? "one_week" : queryTime);
		map.put("PageUtil", pUtil);
		return "/page/account/moneyhistory/index.jsp";
	}

	/**
	 * <pre>
	 * 银行卡管理
	 * </pre>
	 * @param map
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/cardManager")
	public String cardManager(ModelMap map, HttpServletRequest request)
	{
		UserInfo m = getSessionMember(request).getUser();
		QueryCardInfoRequestMsg queryCardInfoRequestMsg = new QueryCardInfoRequestMsg();
		queryCardInfoRequestMsg.setUserName(m.getUserName());
		queryCardInfoRequestMsg.setUsrCustId(m.getTrustAccountId());
		queryCardInfoRequestMsg.setPartnerTransType(PartnerTransType.QueryCardInfo);
		queryCardInfoRequestMsg.setTransType(TransCodeConstants.PartnerTransCode.REQUEST);
		QueryCardInfoResponseMsg queryCardInfoResponseMsg = (QueryCardInfoResponseMsg) serviceFactory.getProtFactory()
				.remoteTrans(queryCardInfoRequestMsg);
		map.put("UsrCardInfolist", queryCardInfoResponseMsg.getUsrCardInfolist());
		map.put("userBankCardList", queryCardInfoResponseMsg.getUserBankCardlist());
		map.put("userInfo", m);
		return "/page/account/card/index.jsp";
	}

	/**
	 * <pre>
	 * 转向充值
	 * </pre>
	 * @param map
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/toImprest")
	public String toImprest(ModelMap map, HttpServletRequest request)
	{
		UserInfo userInfo = getSessionMember(request).getUser();
		if (userInfo!=null) {
			Account account=serviceFactory.getAccountService().getAccount(userInfo.getId());
			map.put("account", account);
		}
		return "/page/account/recharge/index.jsp";
	}

	/**
	 * <pre>
	 * 转向提现
	 * </pre>
	 * @param map
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/toDraw")
	public String toDraw(ModelMap map, HttpServletRequest request)
	{
		UserInfo m = getSessionMember(request).getUser();
		QueryCardInfoRequestMsg queryCardInfoRequestMsg = new QueryCardInfoRequestMsg();
		queryCardInfoRequestMsg.setUserName(m.getUserName());
		queryCardInfoRequestMsg.setUsrCustId(m.getTrustAccountId());
		queryCardInfoRequestMsg.setPartnerTransType(PartnerTransType.QueryCardInfo);
		queryCardInfoRequestMsg.setTransType(TransCodeConstants.PartnerTransCode.REQUEST);
		QueryCardInfoResponseMsg queryCardInfoResponseMsg = (QueryCardInfoResponseMsg) serviceFactory.getProtFactory()
				.remoteTrans(queryCardInfoRequestMsg);
		if (PartnerUtil.isTrustPattern())
		{
			map.put("isBindCard", queryCardInfoResponseMsg.getUsrCardInfolist() != null
					&& queryCardInfoResponseMsg.getUsrCardInfolist().size() > 0 ? "1" : "0");
			map.put("bankCardList", queryCardInfoResponseMsg.getUsrCardInfolist());
		}
		else
		{
			map.put("isBindCard", queryCardInfoResponseMsg.getUserBankCardlist() != null
					&& queryCardInfoResponseMsg.getUserBankCardlist().size() > 0 ? "1" : "0");
			map.put("bankCardList", queryCardInfoResponseMsg.getUserBankCardlist());
		}
		Account account = serviceFactory.getAccountService().getAccount(m.getId());
		map.put("account", account);
		return "/page/account/withdrawmoney/index.jsp";
	}

	/**
	 * <pre>
	 * 转向个人设置
	 * </pre>
	 * @param map
	 * @param request
	 * @return
	 */
	@RequestMapping(value = "/toPersonSet")
	public String toPersonSet(ModelMap map, HttpServletRequest request)
	{
		MemberSession session = getSessionMember(request);
		if (session == null || session.getUser() == null)
		{
			return "/";
		}
		refreshSessionMember(request);
		UserInfo user = session.getUser();
		if (user == null)
		{
			return "/";
		}
		// 安全等级
		int checkCount = 0;
		if (user.getIsEmailCheck() == BoolValue.YES)
		{
			checkCount++;
		}
		if (user.getIsMobileCheck() == BoolValue.YES)
		{
			checkCount++;
		}
		if (user.getIsQuestionCheck() == BoolValue.YES)
		{
			checkCount++;
		}
		if (user.getIsRealNameCheck() == BoolValue.YES)
		{
			checkCount++;
		}
		map.put("checkCount", checkCount);
		map.put("questionType", UserInfo.UserQuestionType.values());
		return "/page/account/my/index.jsp";
	}

	/**
	 * 实名认证
	 * @param request
	 */
	@RequestMapping(value = "/realNameAuth")
	@ResponseBody
	public ServiceResult<String> realNameAuth(HttpServletRequest request, ModelMap map, String realName,
			String cardNumber)
	{
		ServiceResult<String> result = new ServiceResult<String>();
		MemberSession session = getSessionMember(request);
		if (session == null)
		{
			return validateFailure("登录过期，请重新登录");
		}
		UserInfo user = session.getUser();
		if (user == null)
		{
			return validateFailure("登录过期，请重新登录");
		}
		if (StringUtils.isEmpty(realName) || StringUtils.isEmpty(cardNumber))
		{
			return validateFailure("参数为空");
		}
		UserInfoResponse response = this.serviceFactory.getUserService().realNameAuth(user.getUserName(), realName,
				cardNumber);
		if (response != null)
		{
			if (RespCodeConstants.CommonCode.TRANS_SUC.equals(response.getRespCode()))
			{
				result.setIsSuccess(true);
				result.setMessage("实名成功");
				refreshSessionMember(request);
			}
			else
			{
				return validateFailure(response.getRespDesc());
			}
		}
		else
		{
			return validateFailure("实名认证失败");
		}
		return result;
	}

	/**
	 * 修改密码
	 * @param request
	 */
	@RequestMapping(value = "/updatePassword")
	@ResponseBody
	public ServiceResult<String> updatePassword(HttpServletRequest request, ModelMap map, String oldPassword,
			String password)
	{
		ServiceResult<String> result = new ServiceResult<String>();
		MemberSession session = getSessionMember(request);
		if (session == null)
		{
			return validateFailure("登录过期，请重新登录");
		}
		UserInfo user = session.getUser();
		if (user == null)
		{
			return validateFailure("登录过期，请重新登录");
		}
		if (StringUtils.isEmpty(oldPassword) || StringUtils.isEmpty(password))
		{
			return validateFailure("参数为空");
		}
		int pleng = password.length();
		if (pleng < 6 || pleng > 16)
		{
			return validateFailure("密码字符长度应为6-16之间");
		}
		UserInfoResponse response = this.serviceFactory.getUserService().updatePassword(user.getUserName(),
				oldPassword, password);
		if (response != null)
		{
			if (RespCodeConstants.CommonCode.TRANS_SUC.equals(response.getRespCode()))
			{
				result.setIsSuccess(true);
				result.setMessage("修改密码成功");
				refreshSessionMember(request);
			}
			else
			{
				return validateFailure(response.getRespDesc());
			}
		}
		else
		{
			return validateFailure("修改密码失败");
		}
		return result;
	}

	/**
	 * 设置密保
	 * @param request
	 */
	@RequestMapping(value = "/doSetQuestion")
	@ResponseBody
	public ServiceResult<String> doSetQuestion(HttpServletRequest request, ModelMap map, String questionType,
			String answer)
	{
		ServiceResult<String> result = new ServiceResult<String>();
		MemberSession session = getSessionMember(request);
		if (session == null)
		{
			return validateFailure("登录过期，请重新登录");
		}
		UserInfo user = session.getUser();
		if (user == null)
		{
			return validateFailure("登录过期，请重新登录");
		}
		if (StringUtils.isEmpty(questionType) || StringUtils.isEmpty(answer))
		{
			return validateFailure("参数为空");
		}

		UserInfoResponse response = this.serviceFactory.getUserService().doSetQuestion(user.getUserName(),
				questionType, answer);
		if (response != null)
		{
			if (RespCodeConstants.CommonCode.TRANS_SUC.equals(response.getRespCode()))
			{
				result.setIsSuccess(true);
				result.setMessage("设置密保成功");
				refreshSessionMember(request);
			}
			else
			{
				return validateFailure(response.getRespDesc());
			}
		}
		else
		{
			return validateFailure("设置密保失败");
		}
		return result;
	}

	/**
	 * 修改安全问题
	 * @param request
	 */
	@RequestMapping(value = "/upSetQuestion")
	@ResponseBody
	public ServiceResult<String> upSetQuestion(HttpServletRequest request, ModelMap map, String questionTypeold,
			String answerold, String questionTypenew, String answernew)
	{
		ServiceResult<String> result = new ServiceResult<String>();
		MemberSession session = getSessionMember(request);
		if (session == null)
		{
			return validateFailure("登录过期，请重新登录");
		}
		UserInfo user = session.getUser();
		if (user == null)
		{
			return validateFailure("登录过期，请重新登录");
		}
		if (StringUtils.isEmpty(questionTypeold) || StringUtils.isEmpty(answerold)
				|| StringUtils.isEmpty(questionTypenew) || StringUtils.isEmpty(answernew))
		{
			return validateFailure("参数为空");
		}
		user = serviceFactory.getUserService().getUserByUserName(user.getUserName());
		if (user.getQuestionType() != UserQuestionType.valueOf(questionTypeold))
		{
			return validateFailure("老安全问题错误");
		}
		if (!answerold.equals(user.getAnswer()))
		{
			return validateFailure("老安全问题答案错误");
		}
		UserInfoResponse response = this.serviceFactory.getUserService().doSetQuestion(user.getUserName(),
				questionTypenew, answernew);
		if (response != null)
		{
			if (RespCodeConstants.CommonCode.TRANS_SUC.equals(response.getRespCode()))
			{
				result.setIsSuccess(true);
				result.setMessage("修改密保成功");
				refreshSessionMember(request);
			}
			else
			{
				return validateFailure(response.getRespDesc());
			}
		}
		else
		{
			return validateFailure("修改密保失败");
		}
		return result;
	}

	/**
	 * 邮箱验证发送邮件
	 * @param request
	 * @param email 邮箱
	 * @param validCode 验证码
	 * @param returnUrl
	 * @return
	 */
	@RequestMapping(value = "/sendValidEmail")
	@ResponseBody
	public ServiceResult<?> sendValidEmail(HttpServletRequest request, String email, String returnUrl)
	{

		ServiceResult<String> result = new ServiceResult<String>();
		MemberSession session = getSessionMember(request);
		if (session == null)
		{
			return validateFailure("登录过期，请重新登录");
		}
		UserInfo user = session.getUser();
		if (user == null)
		{
			return validateFailure("登录过期，请重新登录");
		}
		if (StringUtils.isEmpty(email))
		{
			return validateFailure("参数为空");
		}
		StringBuffer url = new StringBuffer();
		url.append(request.getScheme());
		url.append("://");
		url.append(request.getServerName());
		url.append(":");
		url.append(request.getServerPort());
		url.append(request.getContextPath());
		url.append("/memberCenter/doValidEmail.htm");
		ResponseMessage response = serviceFactory.getUserService().sendMailForValid(email, user.getUserName(),null,
				url.toString(), returnUrl,null);
		if (response != null)
		{
			if (RespCodeConstants.CommonCode.TRANS_SUC.equals(response.getRespCode()))
			{
				result.setIsSuccess(true);
				result.setMessage("已发送验证邮件");
				refreshSessionMember(request);
			}
			else
			{
				return validateFailure(response.getRespDesc());
			}
		}
		else
		{
			return validateFailure("发送验证邮件失败");
		}
		return result;
	}

	/**
	 * 邮箱验证发送邮件
	 * @param request
	 * @param email 邮箱
	 * @param validCode 验证码
	 * @param returnUrl
	 * @return
	 */
	@RequestMapping(value = "/sendValidEmailCX")
	@ResponseBody
	public ServiceResult<?> sendValidEmailCX(HttpServletRequest request, String oldemail, String newemail,
			String returnUrl)
	{
		ServiceResult<String> result = new ServiceResult<String>();
		MemberSession session = getSessionMember(request);
		if (session == null)
		{
			return validateFailure("登录过期，请重新登录");
		}
		UserInfo user = session.getUser();
		if (user == null)
		{
			return validateFailure("登录过期，请重新登录");
		}
		if (StringUtils.isEmpty(oldemail) || StringUtils.isEmpty(newemail))
		{
			return validateFailure("参数为空");
		}
		StringBuffer url = new StringBuffer();
		url.append(request.getScheme());
		url.append("://");
		url.append(request.getServerName());
		url.append(":");
		url.append(request.getServerPort());
		url.append(request.getContextPath());
		url.append("/memberCenter/doValidEmail.htm");
		ResponseMessage response = serviceFactory.getUserService().sendMailForValid(newemail, user.getUserName(),null,
				url.toString(), returnUrl,null);
		if (response != null)
		{
			if (RespCodeConstants.CommonCode.TRANS_SUC.equals(response.getRespCode()))
			{
				result.setIsSuccess(true);
				result.setMessage("已发送验证邮件");
				refreshSessionMember(request);
			}
			else
			{
				return validateFailure(response.getRespDesc());
			}
		}
		else
		{
			return validateFailure("发送验证邮件失败");
		}
		return result;
	}

	/**
	 * 邮箱验证邮件确认
	 * @param validCode 验证码
	 * @param request
	 * @param type 访问类型
	 * @param modelMap
	 * @param username 用户名称
	 * @param verifyCode 验证码
	 * @param email 邮箱
	 * @return
	 */
	@RequestMapping(value = "/doValidEmail")
	public String doValidEmail(HttpServletRequest request, String successUrl,String errorUrl, ModelMap modelMap, String username,
			String verifyCode, String email)
	{

		String message = "";
		try
		{
			DES des = new DES();
			username = des.decrypt(username);
			email = des.decrypt(email);
			successUrl = des.decrypt(successUrl);
			errorUrl = des.decrypt(errorUrl);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		MemberSession session = getSessionMember(request);
		if (session == null)
		{
			modelMap.put("valid_Email_Message", "登录过期，请重新登录");
			return errorUrl;
		}
		UserInfo user = session.getUser();
		if (user == null)
		{
			modelMap.put("valid_Email_Message", "登录过期，请重新登录");
			return errorUrl;
		}
		UserInfo user2 = serviceFactory.getUserService().getUserByUserName(username);
		if (user2 == null)
		{
			modelMap.put("valid_Email_Message", "此链接无效");
			return errorUrl;
		}
		if (user.getUserName().equals(username))
		{
			ResponseMessage response = serviceFactory.getUserService().doValidEmail(username, verifyCode, email);
			if (response != null)
			{
				if (RespCodeConstants.CommonCode.TRANS_SUC.equals(response.getRespCode()))
				{
					message = "邮箱绑定成功";
				}
				else
				{
					message = response.getRespDesc();
				}
			}
		}
		else
		{
			message = "此链接无效";
		}
		successUrl = ((successUrl == null || successUrl.length() < 1) ? "/memberCenter/toPersonSet.htm" : successUrl);
		modelMap.put("valid_Email_Message", message);
		refreshSessionMember(request);
		return successUrl;
	}

	/**
	 * 手机验证发送短信
	 * @return
	 */
	@RequestMapping(value = "/sendValidSMS")
	@ResponseBody
	public ServiceResult<Long> sendValidSMS(HttpServletRequest request, String mobile)
	{
		ServiceResult<Long> result = new ServiceResult<Long>();
		UserInfo user = serviceFactory.getUserService().getUserByMobile(mobile);
		if (user != null)
		{
			return validateFailure("新手机号码已经存在");
		}
		MemberSession session = getSessionMember(request);
		if (session == null)
		{
			return validateFailure("登录过期，请重新登录");
		}
		user = session.getUser();
		if (user == null)
		{
			return validateFailure("登录过期，请重新登录");
		}
		if (StringUtils.isEmpty(mobile))
		{
			return validateFailure("参数为空");
		}
		Object sendTime = request.getSession().getAttribute("SMSTIME");
		long timeInterval = 30l;
		long nowTime = Calendar.getInstance().getTimeInMillis();
		if (sendTime == null)
		{
			request.getSession().setAttribute("SMSTIME", nowTime);
		}
		else
		{
			long countDown = nowTime - Long.parseLong(String.valueOf(sendTime));
			if (countDown >= 1000 * timeInterval)
			{
				request.getSession().setAttribute("SMSTIME", nowTime);
			}
			else
			{
				return validateFailure((timeInterval - countDown / 1000) + "s后，才能再次发送短信验证码");
			}
		}
		ResponseMessage response = serviceFactory.getUserService().sendSMSForValidMobile(user.getUserName(), mobile,
				null, VerifyType.VALIDMOBILE);
		if (response != null)
		{
			if (RespCodeConstants.CommonCode.TRANS_SUC.equals(response.getRespCode()))
			{
				result.setIsSuccess(true);
				result.setMessage("发送验证短信成功");
				result.setReturnValue(timeInterval);
			}
			else
			{
				return validateFailure(response.getRespDesc());
			}
		}
		else
		{
			return validateFailure("发送验证短信失败");
		}
		return result;
	}

	/**
	 * 获取可以再次发送短信的时间
	 * @return
	 */
	@RequestMapping(value = "/getSendTime")
	@ResponseBody
	public ServiceResult<Long> getSendTime(HttpServletRequest request)
	{
		ServiceResult<Long> result = new ServiceResult<Long>();
		Object sendTime = request.getSession().getAttribute("SMSTIME");
		if (sendTime == null)
		{
			result.setIsSuccess(false);
			result.setReturnValue(-1L);
		}
		else
		{
			long nowTime = Calendar.getInstance().getTimeInMillis();
			long countDown = nowTime - Long.parseLong(String.valueOf(sendTime));
			long timeInterval = 30l;
			if (countDown >= 1000 * timeInterval)
			{
				request.getSession().removeAttribute("SMSTIME");
				result.setReturnValue(-1L);
			}
			else
			{
				result.setReturnValue(timeInterval - countDown / 1000);
			}
		}
		return result;
	}

	/**
	 * 手机验证绑定
	 * @param request
	 * @param mobile 手机号
	 * @param code 短信验证码
	 * @return
	 */
	@RequestMapping(value = "/doValidSMS")
	@ResponseBody
	public ServiceResult<Long> doValidSMS(HttpServletRequest request, String mobile, String code)
	{
		ServiceResult<Long> result = new ServiceResult<Long>();
		UserInfo user = serviceFactory.getUserService().getUserByMobile(mobile);
		if (user != null)
		{
			return validateFailure("新手机号码已经存在");
		}
		MemberSession session = getSessionMember(request);
		if (session == null)
		{
			return validateFailure("登录过期，请重新登录");
		}
		user = session.getUser();
		if (user == null)
		{
			return validateFailure("登录过期，请重新登录");
		}
		if (StringUtils.isEmpty(mobile) || StringUtils.isEmpty(code))
		{
			return validateFailure("参数为空");
		}
		ResponseMessage response = serviceFactory.getUserService().doValidMobile(user.getUserName(), mobile, code,
				VerifyType.VALIDMOBILE);
		if (response != null)
		{
			if (RespCodeConstants.CommonCode.TRANS_SUC.equals(response.getRespCode()))
			{
				ResponseMessage bingMes=serviceFactory.getUserService().bingMobile(user.getUserName(), mobile);
				if(RespCodeConstants.CommonCode.TRANS_SUC.equals(bingMes.getRespCode())){
					result.setIsSuccess(true);
					result.setMessage("修改手机绑定成功");
				}else{
					return validateFailure(bingMes.getRespDesc());
				}
			}
			else
			{
				return validateFailure(response.getRespDesc());
			}
		}
		else
		{
			return validateFailure("修改手机绑定失败");
		}
		refreshSessionMember(request);
		return result;
	}
}
